﻿/*========================== 
 * @author 郑金泉
 * @desc SQL ORDER BY 条件类
 * ========================= */
using System;
using System.Collections.Generic;
using System.Text;

using Obsidian.Edm;

namespace Obsidian.Data.Sql
{
    public class OrderByClause
    {

        public OrderByClause(IModelField field, OrderType type)
        {
            this._modelField = field;
            this._orderByType = type;
        }

        private IModelField _modelField;
        public IModelField Field
        {
            get { return this._modelField; }
        }

        private OrderType _orderByType = OrderType.ASC;
        public OrderType Type
        {
            get { return this._orderByType; }
        }

        public string BuildSqlText()
        {
            string strType = this._orderByType == OrderType.ASC ? "ASC" : "DESC";
            return this._modelField.GetDbField().TablePrefixName + " " + strType;
        }

    }


}
